/**
 *
 */
package com.ybkj.daijia.server.service.impl;

import com.ybkj.daijia.server.mapper.OrderFinishedInfoMapper;
import com.ybkj.daijia.server.model.OrderFinishedInfo;
import com.ybkj.daijia.server.service.OrderFinishedInfoService;
import java.util.Date;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.ApplicationEventMulticaster;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author Shine
 *
 */
@Service
public class DefaultOrderFinishedInfoService implements OrderFinishedInfoService {

    private static final Logger logger = LoggerFactory
        .getLogger(DefaultOrderFinishedInfoService.class);

    @Autowired
    private OrderFinishedInfoMapper orderFinishedInfoMapper;

    @Autowired
    private ApplicationEventMulticaster applicationEventMulticaster;

    /* (non-Javadoc)
     * @see com.ybkj.shop.service.AdminService#queryAll()
     */

    @Transactional(rollbackFor = Exception.class)
    public OrderFinishedInfo insertRecord(OrderFinishedInfo orderFinishedInfo) {

        orderFinishedInfoMapper.insertRecord(orderFinishedInfo);

        return orderFinishedInfo;
    }

    @Override
    public OrderFinishedInfo findOne(Long id) {

        return orderFinishedInfoMapper.selectByPrimaryKey(id);
    }

    @Override
    public OrderFinishedInfo findByOrder(Long orderId) {

        return orderFinishedInfoMapper.selectByOrder(orderId);
    }

    @Override
    public List<OrderFinishedInfo> findByIdIn(Long[] ids) {

        return orderFinishedInfoMapper.selectByIdIn(ids);
    }

    @Transactional(rollbackFor = Exception.class)
    public void delete(OrderFinishedInfo orderFinishedInfo) {

        orderFinishedInfoMapper.deleteByPrimaryKey(orderFinishedInfo.getId());

    }

    @Transactional(rollbackFor = Exception.class)
    public OrderFinishedInfo update(OrderFinishedInfo orderFinishedInfo) {
        orderFinishedInfoMapper.updateByPrimaryKey(orderFinishedInfo);

        return orderFinishedInfo;
    }

    @Override
    public List<OrderFinishedInfo> findBycompanyId(Long companyId, Date start,
        Date end) {

        return orderFinishedInfoMapper.findBycompanyId(companyId, start, end);
    }


}
